You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gpu-config [2/13]: identify driver loads and driver readiness - #3248
Part of #3246 (2/13). Depends on: none. Review only the last commit.
Adds internal/gpuconfig/loadid: the driver load ID (the inode of /sys/module/nvidia) and the driver readiness check, based on the
validator's ready files. Not used yet.
The change adds a loadid package that reads the NVIDIA module inode and checks driver metadata and readiness. It also adds a statefile package with a versioned apply and gate state model, state predicates, and locked reads and writes that replace the state file atomically.
Merge Risk: Low · up to dcce9
This change adds helper packages that are not yet wired into anything, so there is no current user impact. A malformed state file with duplicate version keys could later leave the state file unreadable. Two tests would not catch regressions in read-error handling and write-base invalidation. These are small, low-risk follow-ups.
Security architecture risk: Minimal · up to dcce9
The new contracts warrant design review, but the helpers are not yet connected to production actions. The inspected change establishes no material security regression or weakened failure-containment guarantee.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The intended state scope is node-local GPU configuration and allocator gating, not tenant or cluster-wide persistence. Production consequences remain unwired in this revision, so the exported Go APIs do not by themselves establish an externally attackable entrypoint.
Trust Boundaries and Controls
observed — Ownership detection trusts label-selected DaemonSets in a caller-selected namespace and their controller API group and kind. It does not verify the owner's existence or UID. Readiness also trusts local marker-file contents. These are metadata and filesystem trust assumptions, not authentication controls; no new privileged consumer was found.
Hardening Proposals
proposed — When integrating privileged callers, explicitly preserve module-identity freshness across readiness checks, GPU actions, and decision writes. Establish directory ownership and recovery behavior as part of that integration rather than treating marker files or advisory locking as authentication.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
The reason will be displayed to describe this comment to others. Learn more.
Note
Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.
Other comments: 1
internal/gpuconfig/statefile/state.go: 1
101-101: Minor · Data Integrity & Integration · Quick win
Reject inconsistent decoded and retained state.
{"version":1,"version":null} passes the State decode because JSON null leaves the integer unchanged. The raw-map decode retains only version:null. These behaviors follow Go 1.26.3 decoding rules. (raw.githubusercontent.com)
After a successful Lock.Read, WriteGatePass(7) renames content containing version:null over the state file. Its final parse then fails. Later reads return ErrParse, and writes remain blocked.
Decode State from the same normalized representation used for writes, or reject ambiguous keys before accepting the file. Preserve ordinary version-1 files and unknown top-level keys.
Check the selector against the literal label contract.
Production and this assertion use DriverDaemonSetSelector. If that constant changes to an incorrect selector, every fake-lister case still passes. A real list could then miss operator-managed driver DaemonSets.
Assert the literal value "app.kubernetes.io/component=nvidia-driver" instead.
As per path instructions, “Flag tests that mirror the implementation instead of checking behavior.”
Cover the non-ENOENT read-error path in the Ready tests.
TestReadyErrorOnUnreadableDriverReady uses a readable file, so it exercises only the parse-error branch. If readDriverInfo suppressed non-ENOENT read errors, such as permission failures, this test would still pass. The test name also does not match its fixture.
Keep this parser-error case. Add a case where DriverReadyFile is a directory. os.ReadFile then fails with EISDIR, which readDriverInfo must report as an error with ok=false:
Cover a failed read after a successful read in the same hold.
TestWriteAfterAFailedReadFails starts with l.base == nil. A Lock.Read that keeps an earlier successful base after a failed read would leave the write refused, so this test would still pass. The test does not exercise the state that the regression changes.
Rewrite the test so it:
Writes a valid state file and calls l.Read() successfully in the same hold.
Replaces the file with {"version":2}.
Calls l.Read() again and requires ErrParse.
Requires l.WriteGatePass(7) to fail.
Requires the file contents to remain {"version":2}.
With this sequence, a Read that keeps the earlier base can let WriteGatePass overwrite the corrupted file. The final content assertion then fails.
Reviewing files that changed from the base of the PR and between 246a9ca and dcce9b9.
Files selected for processing: 7
internal/gpuconfig/loadid/driver.go
internal/gpuconfig/loadid/loadid.go
internal/gpuconfig/loadid/loadid_test.go
internal/gpuconfig/statefile/file.go
internal/gpuconfig/statefile/file_test.go
internal/gpuconfig/statefile/state.go
internal/gpuconfig/statefile/state_test.go
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.
henry118
changed the title
gpu-config: identify driver loads and driver readiness
gpu-config [2/13]: identify driver loads and driver readiness
Nov 19, 2026
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #3246 (2/13). Depends on: none. Review only the last commit.
Adds
internal/gpuconfig/loadid: the driver load ID (the inode of/sys/module/nvidia) and the driver readiness check, based on thevalidator's ready files. Not used yet.